package com.vf.admin.client.dao;

import com.vf.admin.common.db.BaseDao;
import com.vf.admin.miaodong.entity.AppFeedbackType;
import com.vf.admin.utils.StringEx;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Repository
public class AppFeedbackTypeDao extends BaseDao<AppFeedbackType>{

    /**
     * 查询列表
     */
    public List<AppFeedbackType> list(Map<String, Object> paraMap) {
        ArrayList<Object> paramList = new ArrayList<Object>();
        StringBuilder sbStr = new StringBuilder("select * from app_feedback_type where 1=1  ");
        sbStr.append(" order by createtime desc");
        String sql = sbStr.toString();
        return this.queryList(sql, paramList, AppFeedbackType.class);
    }


    /**
     * 详情
     */
    public AppFeedbackType get(Integer id) {
        if (id==null || id<=0) {
            return null;
        }
        List<Object> paramList = new ArrayList<Object>();
        StringBuilder sbStr = new StringBuilder("select * from app_feedback_type where id = ?  ");
        paramList.add(id);
        String sql = sbStr.toString();
        return this.queryObj(sql, paramList, AppFeedbackType.class);
    }

    /**
     * 添加/修改
     */
    public void save(AppFeedbackType haoYou) {
        if (haoYou!=null && haoYou.getId() != null && haoYou.getId() > 0) {
            this.update(haoYou);
        } else {
            haoYou.setId(this.add(haoYou));
        }
    }

    /**
     * 删除
     */
    public void del(Integer id) {
        if (id==null || id <= 0) {
            return;
        }
        String sql = "delete  from app_feedback_type where id = ?";
        ArrayList<Object> paramList = new ArrayList<Object>();
        paramList.add(id);
        this.del(sql, paramList);
    }

}
